

version 15
capture log close
set more off
clear
clear matrix
clear mata

if c(username)=="WB485280" {
		glo rootdir		"C:\Users\wb485280\OneDrive - WBG\radicalization"
		}
if c(username)=="WB382635" {
		glo rootdir		"C:\Users\wb382635\Dropbox\Unemp & daesh"
		}
if c(username)=="WB452275" {
		glo rootdir		"C:\Users\WB452275\Dropbox\Projects\Unemp & daesh"
		}
if c(username)=="sarurchaudhary" {
		glo rootdir		"/Users/sarurchaudhary/Dropbox/Unemp & daesh"
		}
if c(username)=="kartikabhatia" {
			glo rootdir		"/Users/kartikabhatia/Dropbox/Before2019/Unemp & daesh"
			}
			
		glo	datadir     "${rootdir}/Data/Raw data"
		glo outdir		"${rootdir}/Data/Working datasets"
		glo dodir		"${rootdir}/Dofiles"
        
			
			cd "${outdir}"
			
* ------------------------------------------------------------------------------

* Date : March 2021 [Checked Oct 2021]

* Project : Daesh FF Working Paper (The World Bank)

* This is the do file for Table 5 in the main paper

* ------------------------------------------------------------------------------
				
	
	
***************************************************************************
*Table 5 : Robustness to distance interaction
*panel A
***************************************************************************
	use "${outdir}/finaldata_CE.dta", clear 
		
		data_preamble //Invoking data prep program to clean data and create variables
		
		//Altering variable labels
		la var unemp_logdistance             "\textbf{Interaction between unemployment and}\\Distance to Syria (log)"
	
		
	    global unresc_all ="log_dist_tosyria log_gdp_pc log_pop_muslim_pew log_pop_tot political_rights corruption_index"
	    global resc_fe  ="unemp_logdistance unemp_resc_loggdp unemp_resc_logmuslimpop unemp_resc_logpop_tot unemp_resc_politicalrts unemp_resc_corruption"
        global options1 ="dec(3) nocons word se lab nor2"
		global sortlist ="ilo2_unemp_educ log_wage2lag6  log_ilo2_pop $unresc_all unemp_secondary unemp_tertiary $resc_fe"
		global drop_resc="ctrydummy1-ctrdummy168 educ2 educ3 1b.education_level#co.ilo2_unemp_educ  o.resc_corruption_index o.resc_log_pop_tot o.ilo2_unemp_educ o.hdi o.gini o.resc_political_rights o.resc_fraction_language o.resc_fraction_religion o.resc_fraction_ethnic o.resc_log_pop_muslim_pew o.log_dist_tosyria o.resc_log_gdp_pc"
        global options2  ctitle("$ log N_{ce}$")  nonotes 

 
   		*Panel A Column 1
   		xtreg logn_educ ilo2_unemp_educ log_ilo2_pop unemp_logdistance  educ2 educ3,  fe  vce(cluster ctry)
		mean nisis_educ if e(sample) // should be only for countries close to Syria
		local mean=round(_b[nisis_educ],.1) 
		xtreg logn_educ ilo2_unemp_educ log_ilo2_pop unemp_logdistance  educ2 educ3,  fe  vce(cluster ctry)		
		local clust= e(N_clust)
		areg logn_educ ilo2_unemp_educ log_ilo2_pop unemp_logdistance  educ2 educ3,  absorb(ctry)  vce(cluster ctry)
        local adjr =round(e(r2_a), .001)
		local adjr : di %3.2g `adjr'
		xtreg logn_educ ilo2_unemp_educ log_ilo2_pop unemp_logdistance  educ2 educ3,  fe  vce(cluster ctry)
		outreg2 using table7_1_new_dist.docx , tex(frag) $options1 $options2 noni sortvar($sortlist)  drop ($drop_resc ctrydummy*) replace addtext("Mean $ N_{ce}$", `mean', Number of countries, `clust', Country FE, Y, Education Dummies, Y, Adj. R-squared, `adjr' )  

        *Panel A Column 2
      	xtreg logn_educ ilo2_unemp_educ log_ilo2_pop unemp_loggdp     educ2 educ3,  fe  vce(cluster ctry)
		mean nisis_educ if e(sample) // should be only for countries close to Syria
		local mean=round(_b[nisis_educ],.1) 
		xtreg logn_educ ilo2_unemp_educ log_ilo2_pop unemp_loggdp          educ2 educ3,  fe  vce(cluster ctry)		
		local clust= e(N_clust)
		areg logn_educ ilo2_unemp_educ log_ilo2_pop unemp_loggdp           educ2 educ3,  absorb(ctry)  vce(cluster ctry)
        local adjr =round(e(r2_a), .001)
		local adjr : di %3.2g `adjr'
		xtreg logn_educ ilo2_unemp_educ log_ilo2_pop unemp_loggdp          educ2 educ3,  fe  vce(cluster ctry)
		outreg2 using table7_1_new_dist.docx , tex(frag) $options1 $options2 noni sortvar($sortlist)  drop ($drop_resc ctrydummy*) append addtext("Mean $ N_{ce}$", `mean', Number of countries, `clust', Country FE, Y, Education Dummies, Y, Adj. R-squared, `adjr' )  
    
        *Panel A Column 3
      	xtreg logn_educ ilo2_unemp_educ log_ilo2_pop  unemp_frac_muslim           educ2 educ3,  fe  vce(cluster ctry)
		mean nisis_educ if e(sample) // should be only for countries close to Syria
		local mean=round(_b[nisis_educ],.1) 
		xtreg logn_educ ilo2_unemp_educ log_ilo2_pop   unemp_frac_muslim         educ2 educ3,  fe  vce(cluster ctry)		
		local clust= e(N_clust)
		areg logn_educ ilo2_unemp_educ log_ilo2_pop   unemp_frac_muslim        educ2 educ3,  absorb(ctry)  vce(cluster ctry)
        local adjr =round(e(r2_a), .001)
		local adjr : di %3.2g `adjr'
		xtreg logn_educ ilo2_unemp_educ log_ilo2_pop   unemp_frac_muslim        educ2 educ3,  fe  vce(cluster ctry)
		outreg2 using table7_1_new_dist.docx , tex(frag) $options1 $options2 noni sortvar($sortlist)  drop ($drop_resc ctrydummy*) append addtext("Mean $ N_{ce}$", `mean', Number of countries, `clust', Country FE, Y, Education Dummies, Y, Adj. R-squared, `adjr' )  

        *Panel A Column 4
      	xtreg logn_educ ilo2_unemp_educ log_ilo2_pop unemp_logdistance   unemp_loggdp            educ2 educ3,  fe  vce(cluster ctry)
		mean nisis_educ if e(sample) // should be only for countries close to Syria
		local mean=round(_b[nisis_educ],.1) 
		xtreg logn_educ ilo2_unemp_educ log_ilo2_pop unemp_logdistance   unemp_loggdp         educ2 educ3,  fe  vce(cluster ctry)		
		local clust= e(N_clust)
		areg logn_educ ilo2_unemp_educ log_ilo2_pop unemp_logdistance   unemp_loggdp          educ2 educ3,  absorb(ctry)  vce(cluster ctry)
        local adjr =round(e(r2_a), .001)
		local adjr : di %3.2g `adjr'
		xtreg logn_educ ilo2_unemp_educ log_ilo2_pop unemp_logdistance   unemp_loggdp           educ2 educ3,  fe  vce(cluster ctry)
		outreg2 using table7_1_new_dist.docx , tex(frag) $options1 $options2 noni sortvar($sortlist)  drop ($drop_resc ctrydummy*) append addtext("Mean $ N_{ce}$", `mean', Number of countries, `clust', Country FE, Y, Education Dummies, Y, Adj. R-squared, `adjr' )  
       
        *Panel A Column 5
      	xtreg logn_educ ilo2_unemp_educ log_ilo2_pop unemp_logdistance   unemp_frac_muslim           educ2 educ3,  fe  vce(cluster ctry)
		mean nisis_educ if e(sample) // should be only for countries close to Syria
		local mean=round(_b[nisis_educ],.1) 
		xtreg logn_educ ilo2_unemp_educ log_ilo2_pop unemp_logdistance  unemp_frac_muslim          educ2 educ3,  fe  vce(cluster ctry)		
		local clust= e(N_clust)
		areg logn_educ ilo2_unemp_educ log_ilo2_pop unemp_logdistance   unemp_frac_muslim          educ2 educ3,  absorb(ctry)  vce(cluster ctry)
        local adjr =round(e(r2_a), .001)
		local adjr : di %3.2g `adjr'
		xtreg logn_educ ilo2_unemp_educ log_ilo2_pop unemp_logdistance   unemp_frac_muslim         educ2 educ3,  fe  vce(cluster ctry)
		outreg2 using table7_1_new_dist.docx , tex(frag) $options1 $options2 noni sortvar($sortlist)  drop ($drop_resc ctrydummy*) append addtext("Mean $ N_{ce}$", `mean', Number of countries, `clust', Country FE, Y, Education Dummies, Y, Adj. R-squared, `adjr' )  
        
        *Panel A Column 6
      	xtreg logn_educ ilo2_unemp_educ log_ilo2_pop unemp_loggdp unemp_frac_muslim          educ2 educ3,  fe  vce(cluster ctry)
		mean nisis_educ if e(sample) // should be only for countries close to Syria
		local mean=round(_b[nisis_educ],.1) 
		xtreg logn_educ ilo2_unemp_educ log_ilo2_pop  unemp_loggdp   unemp_frac_muslim       educ2 educ3,  fe  vce(cluster ctry)		
		local clust= e(N_clust)
		areg logn_educ ilo2_unemp_educ log_ilo2_pop unemp_loggdp unemp_frac_muslim          educ2 educ3,  absorb(ctry)  vce(cluster ctry)
        local adjr =round(e(r2_a), .001)
		local adjr : di %3.2g `adjr'
		xtreg logn_educ ilo2_unemp_educ log_ilo2_pop unemp_loggdp unemp_frac_muslim            educ2 educ3,  fe  vce(cluster ctry)
		outreg2 using table7_1_new_dist.docx , tex(frag) $options1 $options2 noni sortvar($sortlist)  drop ($drop_resc ctrydummy*) append addtext("Mean $ N_{ce}$", `mean', Number of countries, `clust', Country FE, Y, Education Dummies, Y, Adj. R-squared, `adjr' )  

        *Panel A Column 7
      	xtreg logn_educ ilo2_unemp_educ log_ilo2_pop unemp_logdistance    unemp_loggdp unemp_frac_muslim           educ2 educ3,  fe  vce(cluster ctry)
		mean nisis_educ if e(sample) // should be only for countries close to Syria
		local mean=round(_b[nisis_educ],.1) 
		xtreg logn_educ ilo2_unemp_educ log_ilo2_pop unemp_logdistance    unemp_loggdp unemp_frac_muslim        educ2 educ3,  fe  vce(cluster ctry)		
		local clust= e(N_clust)
		areg logn_educ ilo2_unemp_educ log_ilo2_pop unemp_logdistance    unemp_loggdp unemp_frac_muslim           educ2 educ3,  absorb(ctry)  vce(cluster ctry)
        local adjr =round(e(r2_a), .001)
		local adjr : di %3.2g `adjr'
		xtreg logn_educ ilo2_unemp_educ log_ilo2_pop unemp_logdistance    unemp_loggdp unemp_frac_muslim          educ2 educ3,  fe  vce(cluster ctry)
		outreg2 using table7_1_new_dist.docx , tex(frag) $options1 $options2 noni sortvar($sortlist)  drop ($drop_resc ctrydummy*) append addtext("Mean $ N_{ce}$", `mean', Number of countries, `clust', Country FE, Y, Education Dummies, Y, Adj. R-squared, `adjr' )  

	
	
	

***************************************************************************
*Table 5 : Robustness to distance interaction
*panel B
***************************************************************************
	use "${outdir}/finaldata_CE.dta", clear 
		
		data_preamble //Invoking data prep program to clean data and create variables
		
		//Altering variable labels
		la var unemp_logdistance             "\textbf{Interaction between unemployment and}\\Distance to Syria (log)"
		
		
	    global unresc_all ="log_dist_tosyria log_gdp_pc log_pop_muslim_pew log_pop_tot political_rights corruption_index"
	    global resc_fe  ="unemp_logdistance unemp_resc_loggdp unemp_resc_logmuslimpop unemp_resc_logpop_tot unemp_resc_politicalrts unemp_resc_corruption"
        global options1 ="dec(3) nocons word se lab nor2"
		global sortlist ="ilo2_unemp_educ log_wage2lag6  log_ilo2_pop $unresc_all unemp_secondary unemp_tertiary $resc_fe"
		global drop_resc="ctrydummy1-ctrdummy168 educ2 educ3 1b.education_level#co.ilo2_unemp_educ  o.resc_corruption_index o.resc_log_pop_tot o.ilo2_unemp_educ o.hdi o.gini o.resc_political_rights o.resc_fraction_language o.resc_fraction_religion o.resc_fraction_ethnic o.resc_log_pop_muslim_pew o.log_dist_tosyria o.resc_log_gdp_pc"
        global options2  ctitle("$ log N_{ce}$") nonotes 

 
   	*Panel B Column 1
   		xtreg logn_educ ilo2_unemp_educ log_ilo2_pop unemp_logdistance  educ2 educ3,  fe  vce(cluster ctry)
		mean nisis_educ if e(sample) // should be only for countries close to Syria
		local mean=round(_b[nisis_educ],.1) 
		xtreg logn_educ ilo2_unemp_educ log_ilo2_pop unemp_logdistance  educ2 educ3,  fe  vce(cluster ctry)		
		local clust= e(N_clust)
		areg logn_educ ilo2_unemp_educ log_ilo2_pop unemp_logdistance  educ2 educ3,  absorb(ctry)  vce(cluster ctry)
        local adjr =round(e(r2_a), .001)
		local adjr : di %3.2g `adjr'
		xtreg logn_educ ilo2_unemp_educ log_ilo2_pop unemp_logdistance  educ2 educ3,  fe  vce(cluster ctry)
		outreg2 using table7_2_new_dist.docx , tex(frag) $options1 $options2 noni sortvar($sortlist)  drop ($drop_resc ctrydummy*) replace addtext("Mean $ N_{ce}$", `mean', Number of countries, `clust', Country FE, Y, Education Dummies, Y, Adj. R-squared, `adjr' )  

	*Panel B Column 2
      	xtreg logn_educ ilo2_unemp_educ log_ilo2_pop unemp_reg_mena           educ2 educ3,  fe  vce(cluster ctry)
		mean nisis_educ if e(sample) // should be only for countries close to Syria
		local mean=round(_b[nisis_educ],.1) 
		xtreg logn_educ ilo2_unemp_educ log_ilo2_pop unemp_reg_mena          educ2 educ3,  fe  vce(cluster ctry)		
		local clust= e(N_clust)
		areg logn_educ ilo2_unemp_educ log_ilo2_pop unemp_reg_mena           educ2 educ3,  absorb(ctry)  vce(cluster ctry)
        local adjr =round(e(r2_a), .001)
		local adjr : di %3.2g `adjr'
		xtreg logn_educ ilo2_unemp_educ log_ilo2_pop unemp_reg_mena          educ2 educ3,  fe  vce(cluster ctry)
		outreg2 using table7_2_new_dist.docx , tex(frag) $options1 $options2 noni sortvar($sortlist)  drop ($drop_resc ctrydummy*) append addtext("Mean $ N_{ce}$", `mean', Number of countries, `clust', Country FE, Y, Education Dummies, Y, Adj. R-squared, `adjr' )  
    
	*Panel B Column 3
      	xtreg logn_educ ilo2_unemp_educ log_ilo2_pop  unemp_reg_officialoecd           educ2 educ3,  fe  vce(cluster ctry)
		mean nisis_educ if e(sample) // should be only for countries close to Syria
		local mean=round(_b[nisis_educ],.1) 
		xtreg logn_educ ilo2_unemp_educ log_ilo2_pop   unemp_reg_officialoecd         educ2 educ3,  fe  vce(cluster ctry)		
		local clust= e(N_clust)
		areg logn_educ ilo2_unemp_educ log_ilo2_pop   unemp_reg_officialoecd        educ2 educ3,  absorb(ctry)  vce(cluster ctry)
        local adjr =round(e(r2_a), .001)
		local adjr : di %3.2g `adjr'
		xtreg logn_educ ilo2_unemp_educ log_ilo2_pop   unemp_reg_officialoecd        educ2 educ3,  fe  vce(cluster ctry)
		outreg2 using table7_2_new_dist.docx , tex(frag) $options1 $options2 noni sortvar($sortlist)  drop ($drop_resc ctrydummy*) append addtext("Mean $ N_{ce}$", `mean', Number of countries, `clust', Country FE, Y, Education Dummies, Y, Adj. R-squared, `adjr' )  

	*Panel B Column 4
      	xtreg logn_educ ilo2_unemp_educ log_ilo2_pop  unemp_logdistance unemp_reg_mena            educ2 educ3,  fe  vce(cluster ctry)
		mean nisis_educ if e(sample) // should be only for countries close to Syria
		local mean=round(_b[nisis_educ],.1) 
		xtreg logn_educ ilo2_unemp_educ log_ilo2_pop unemp_logdistance  unemp_reg_mena         educ2 educ3,  fe  vce(cluster ctry)		
		local clust= e(N_clust)
		areg logn_educ ilo2_unemp_educ log_ilo2_pop unemp_logdistance  unemp_reg_mena          educ2 educ3,  absorb(ctry)  vce(cluster ctry)
        local adjr =round(e(r2_a), .001)
		local adjr : di %3.2g `adjr'
		xtreg logn_educ ilo2_unemp_educ log_ilo2_pop unemp_logdistance  unemp_reg_mena           educ2 educ3,  fe  vce(cluster ctry)
		outreg2 using table7_2_new_dist.docx , tex(frag) $options1 $options2 noni sortvar($sortlist)  drop ($drop_resc ctrydummy*) append addtext("Mean $ N_{ce}$", `mean', Number of countries, `clust', Country FE, Y, Education Dummies, Y, Adj. R-squared, `adjr' )  
       
	*Panel B Column 5
      	xtreg logn_educ ilo2_unemp_educ log_ilo2_pop unemp_logdistance  unemp_reg_officialoecd           educ2 educ3,  fe  vce(cluster ctry)
		mean nisis_educ if e(sample) // should be only for countries close to Syria
		local mean=round(_b[nisis_educ],.1) 
		xtreg logn_educ ilo2_unemp_educ log_ilo2_pop unemp_logdistance unemp_reg_officialoecd          educ2 educ3,  fe  vce(cluster ctry)		
		local clust= e(N_clust)
		areg logn_educ ilo2_unemp_educ log_ilo2_pop unemp_logdistance  unemp_reg_officialoecd          educ2 educ3,  absorb(ctry)  vce(cluster ctry)
        local adjr =round(e(r2_a), .001)
		local adjr : di %3.2g `adjr'
		xtreg logn_educ ilo2_unemp_educ log_ilo2_pop unemp_logdistance  unemp_reg_officialoecd         educ2 educ3,  fe  vce(cluster ctry)
		outreg2 using table7_2_new_dist.docx , tex(frag) $options1 $options2 noni sortvar($sortlist)  drop ($drop_resc ctrydummy*) append addtext("Mean $ N_{ce}$", `mean', Number of countries, `clust', Country FE, Y, Education Dummies, Y, Adj. R-squared, `adjr' )  
        
	*Panel B Column 6
      	xtreg logn_educ ilo2_unemp_educ log_ilo2_pop unemp_reg_mena unemp_reg_officialoecd          educ2 educ3,  fe  vce(cluster ctry)
		mean nisis_educ if e(sample) // should be only for countries close to Syria
		local mean=round(_b[nisis_educ],.1) 
		xtreg logn_educ ilo2_unemp_educ log_ilo2_pop  unemp_reg_mena   unemp_reg_officialoecd       educ2 educ3,  fe  vce(cluster ctry)		
		local clust= e(N_clust)
		areg logn_educ ilo2_unemp_educ log_ilo2_pop unemp_reg_mena unemp_reg_officialoecd          educ2 educ3,  absorb(ctry)  vce(cluster ctry)
        local adjr =round(e(r2_a), .001)
		local adjr : di %3.2g `adjr'
		xtreg logn_educ ilo2_unemp_educ log_ilo2_pop unemp_reg_mena unemp_reg_officialoecd            educ2 educ3,  fe  vce(cluster ctry)
		outreg2 using table7_2_new_dist.docx , tex(frag) $options1 $options2 noni sortvar($sortlist)  drop ($drop_resc ctrydummy*) append addtext("Mean $ N_{ce}$", `mean', Number of countries, `clust', Country FE, Y, Education Dummies, Y, Adj. R-squared, `adjr' )  

	*Panel B Column 7
      	xtreg logn_educ ilo2_unemp_educ log_ilo2_pop unemp_logdistance   unemp_reg_mena unemp_reg_officialoecd           educ2 educ3,  fe  vce(cluster ctry)
		mean nisis_educ if e(sample) // should be only for countries close to Syria
		local mean=round(_b[nisis_educ],.1) 
		xtreg logn_educ ilo2_unemp_educ log_ilo2_pop unemp_logdistance   unemp_reg_mena unemp_reg_officialoecd        educ2 educ3,  fe  vce(cluster ctry)		
		local clust= e(N_clust)
		areg logn_educ ilo2_unemp_educ log_ilo2_pop unemp_logdistance   unemp_reg_mena unemp_reg_officialoecd           educ2 educ3,  absorb(ctry)  vce(cluster ctry)
        local adjr =round(e(r2_a), .001)
		local adjr : di %3.2g `adjr'
		xtreg logn_educ ilo2_unemp_educ log_ilo2_pop unemp_logdistance   unemp_reg_mena unemp_reg_officialoecd          educ2 educ3,  fe  vce(cluster ctry)
		outreg2 using table7_2_new_dist.docx , tex(frag) $options1 $options2 noni sortvar($sortlist)  drop ($drop_resc ctrydummy*) append addtext("Mean $ N_{ce}$", `mean', Number of countries, `clust', Country FE, Y, Education Dummies, Y, Adj. R-squared, `adjr' )  
		

		
		
	

